<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/Store/Public/layui/css/layui.css"></link>
<link type="text/css" rel="stylesheet" href="/Store/Public/Admin/css/H-ui.css"/>
<link type="text/css" rel="stylesheet" href="/Store/Public/Admin/css/H-ui.admin.css"/>
<link type="text/css" rel="stylesheet" href="/Store/Public/Admin/font/font-awesome.min.css"/>

<script type="text/javascript" src="/Store/Public/Admin/js1/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="/Store/Public/layer/layer.js"></script>

<title>编辑用户</title>
</head>
<body>
<div class="pd-20">
  <div class="Huiform">
      <table class="table table-bg">
        <tbody>
          <tr>
            <th width="100" class="text-r"><span class="c-red">*</span> 用户名：</th>
            <td><input type="text" style="width:300px" class="input-text" value="<?php echo ($name); ?>" placeholder="" name="user-name" datatype="*2-16" nullmsg="用户名不能为空"></td>
          </tr>
          <tr>
            <th width="100" class="text-r"><span class="c-red">*</span> 用户名：</th>
            <td><input type="text" style="width:300px" class="input-text" value="" placeholder="" id="user-name" name="user-name" datatype="*2-16" nullmsg="用户名不能为空"></td>
          </tr>
          <tr>
            <th class="text-r">邮箱：</th>
            <td><input type="email" style="width:300px" class="input-text" value="<?php echo ($email); ?>" placeholder="" name="user-email"></td>
          </tr> 
           <tr>
            <th class="text-r">邮箱：</th>
            <td><input type="email" style="width:300px" class="input-text" value="" placeholder="" id="user-email" name="user-email"></td>
          </tr> 
        </tbody>
      </table>
         &nbsp;&nbsp;&nbsp;&nbsp;
      <div class="layui-form-item">
          <div class="layui-input-block">
          <button class="layui-btn"lay-submit lay-fileter="formDemo" id="commit" data-id="<?php echo ($id); ?>">提交</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
         </div>
      </div>
  </div>
</div>
<script>
$('#commit').click(function(){
	var name=$('#user-name').val();
	  if(name.length<1){
		  layer.msg('用户名不能为空',{time:1000})
		 exit();
	  }
	var email=$('#user-email').val();
	var re=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
	   if(re.test(email)){
	 }else{
		 layer.msg('邮箱格式不正确!  xx@.xx.com',{time:1000});
	 }
	var id=$(this).attr('data-id');
    $.post('/Store/index.php/Admin/User/alter',{name:name,email:email,id:id},function(obj){
    	if(obj.pass==1){
    	   layer.msg(obj.msg);
    	}

    })
})
</script>
</body>
</html>